<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<xsl:variable name="maxDate">
			<xsl:for-each select="/statistic/upload/@date">
				<xsl:sort data-type="number" order="descending" />
				<xsl:if test="position()=1">
					<xsl:value-of select="." />
				</xsl:if>
			</xsl:for-each>
		</xsl:variable>
		<html>
			<head>
			</head>
			<body>
				<xsl:variable name="size"
					select="sum(/statistic/upload[@date=$maxDate]/@size)" />
				<xsl:variable name="count"
					select="sum(/statistic/upload[@date=$maxDate]/@count)" />
				<xsl:variable name="time"
					select="sum(/statistic/upload[@date=$maxDate]/@time)" />
				<xsl:variable name="speed"
					select="format-number(($size div $time),'#.00')" />
				<div>
					<table align="center" style="text-align:center;">
						<tbody text-align="middle">
							<th>Size</th>
							<th>Count</th>
							<th>Time</th>
							<th>Speed</th>
							<tr>
								<td width="100px"><xsl:value-of select="$size"/>Byte</td>
								<td width="100px"><xsl:value-of select="$count"/></td>
								<td width="100px"><xsl:value-of select="$time"/>ms</td>
								<td width="100px"><xsl:value-of select="$speed"/>kB/s</td>
							</tr>
						</tbody>
					</table>
				</div>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>